package com.sskj.hhrt.verify;


import android.content.Context;
import android.content.Intent;
import android.widget.Button;
import android.widget.EditText;

import com.hjq.toast.ToastUtils;
import com.sskj.base.utils.CheckUtil;
import com.sskj.base.utils.ClickUtil;
import com.sskj.base.view.ToolBarLayout;
import com.sskj.hhrt.MVPActivity;
import com.sskj.hhrt.R;

import butterknife.BindView;

/**
 * 实名认证 第一步
 *
 * @author Hey
 * Create at  2019/03/20
 */
public class Verify1Activity extends MVPActivity<Verify1Presenter> {

    @BindView(R.id.toolbar)
    ToolBarLayout toolbar;
    @BindView(R.id.edit_name)
    EditText editName;
    @BindView(R.id.edit_idCard)
    EditText editIdCard;
    @BindView(R.id.edit_bank_name)
    EditText editBankName;
    @BindView(R.id.edit_bank_number)
    EditText editBankNumber;
    @BindView(R.id.btn_next)
    Button btnNext;
    @BindView(R.id.edit_bank_province)
    EditText editBankProvince;
    @BindView(R.id.edit_bank_city)
    EditText editBankCity;
    @BindView(R.id.edit_bank_address)
    EditText editBankAddress;

    @Override
    public int getLayoutId() {
        return R.layout.activity_verify1;
    }

    @Override
    public Verify1Presenter getPresenter() {
        return new Verify1Presenter();
    }

    @Override
    public void initView() {
        toolbar.setLeftButtonOnClickListener(v -> finish());
    }

    @Override
    public void initData() {
        ClickUtil.click(btnNext, view -> {
//            if (isEmpty(editName)) {
//                ToastUtils.show("请输入姓名");
//                return;
//            }
//            if (isEmpty(editIdCard)) {
//                ToastUtils.show("请输入身份证号");
//                return;
//            }

            if (isEmpty(editBankName)) {
                ToastUtils.show("请输入银行卡类型");
                return;
            }
//            if (isEmpty(editBankProvince)) {
//                ToastUtils.show("请输入开户行省份");
//                return;
//            }
//
            if (isEmpty(editBankAddress)) {
                ToastUtils.show("请输入开户行地址");
                return;
            }


            if (isEmpty(editBankNumber)) {
                ToastUtils.show("请输入银行卡号");
                return;
            }
            if (getText(editBankNumber).length() <= 14) {
                ToastUtils.show("请输入正确的银行卡号");
                return;
            }
            Verify2Activity.start(this, getText(editBankName), getText(editBankNumber),getText(editBankAddress));
//            mPresenter.verify1(account, getText(editName), getText(editIdCard), getText(editBankName), getText(editBankNumber),getText(editBankProvince),getText(editBankCity),getText(editBankAddress));
        });
    }

    public static void start(Context context) {
        Intent intent = new Intent(context, Verify1Activity.class);
        context.startActivity(intent);
    }



    public void submitSuccess() {
//        Verify2Activity.start(this);
//        finish();
    }

}
